



const emoji = [
    { name: '/哈哈', icon: '😃' },
    { name: '/苦笑', icon: '😅' },
    { name: '/嘻嘻', icon: '😁' },
    { name: '/微笑', icon: '😊' },
    { name: '/倒脸', icon: '🙃' },
    { name: '/飞吻', icon: '😘' },
    { name: '/滑稽', icon: '🤪' },
    { name: '/想一想', icon: '🤔' },
    { name: '/冷漠', icon: '😐' },
    { name: '/无语', icon: '😑' },
    { name: '/得意', icon: '😏' },
    { name: '/不高兴', icon: '😒' },
    { name: '/呲牙咧嘴', icon: '😬' },
    { name: '/沉思', icon: '😔' },
    { name: '/呕吐', icon: '🤮' },
    { name: '/冷脸', icon: '🥶' },
    { name: '/墨镜笑脸', icon: '😎' },
    { name: '/担心', icon: '😟' },
    { name: '/吃惊', icon: '😮' },
    { name: '/震惊', icon: '😲' },
    { name: '/害怕', icon: '😨' },
    { name: '/冷汗', icon: '😰' },
    { name: '/哭', icon: '😢' },
    { name: '/吓死了', icon: '😱' },
    { name: '/困惑', icon: '😖' },
    { name: '/痛苦', icon: '😣' },
    { name: '/怒火中烧', icon: '😡' },
    { name: '/小丑脸', icon: '🤡' },
    { name: '/大笑', icon: '😄' },
    { name: '/斜眼笑', icon: '😆' },
    { name: '/笑哭了', icon: '😂' },
    { name: '/呵呵', icon: '🙂' },
    { name: '/眨眼', icon: '😉' },
    { name: '/花痴', icon: '😍' },
    { name: '/亲亲', icon: '😙' },
    { name: '/好吃', icon: '😋' },
    { name: '/吐舌', icon: '😜' },
    { name: '/安静', icon: '🤫' },
    { name: '/挑眉', icon: '🤨' },
    { name: '/困', icon: '😪' },
    { name: '/睡着了', icon: '😴' },
    { name: '/恶心', icon: '🤢' },
    { name: '/晕头转向', icon: '😵' },
    { name: '/爆炸头', icon: '🤯' },
    { name: '/不满', icon: '☹️' },
    { name: '/大哭', icon: '😭' },
    { name: '/生气', icon: '😠' },
    { name: '/骷髅', icon: '☠️' },
    { name: '/生气的恶魔', icon: '👿' },
    { name: '/恶魔微笑', icon: '😈' },
    { name: '/挥手', icon: '👋' },
    { name: '/举起手', icon: '✋' },
    { name: '/瓦坎达手礼', icon: '🖖' },
    { name: '/OK', icon: '👌' },
    { name: '/胜利手势', icon: '✌️' },
    { name: '/拇指向上', icon: '👍' },
    { name: '/拇指向下', icon: '👎' },
    { name: '/出拳', icon: '👊' },
    { name: '/朝左的拳头', icon: '🤛' },
    { name: '/朝右的拳头', icon: '🤜' },
    { name: '/鼓掌', icon: '👏' },
    { name: '/握手', icon: '🤝' },
    { name: '/双手合十', icon: '🙏' },
    { name: '/肌肉', icon: '💪' },
    { name: '/击剑', icon: '🤺' },
]

function findEmoji(str) {
    let reg = /(?<=\[)[^\]]+/g;
    let matchedName = str.match(reg);
    if (!matchedName) return str;
    matchedName.forEach(name => {
        for (let i = 0; i < emoji.length; i++) {
            if (emoji[i].name === name) {
                str = str.replace(`[${name}]`, emoji[i].icon)
            }
        }
    })
    return str;
}

export {
    emoji,
    findEmoji
}
